﻿--获取部门员工
create proc [dbo].[proc_SitePersonnel_GetDepartList]
(
	@departmentId nvarchar(2000)
)
as
	declare @sql nvarchar (4000)
	set @sql = 'select e.id,e.username,e.ename,(select count(sp.id) from SitePersonnel sp where sp.username=e.username) as ordersCount from employee e where '+'departmentid in ('+@departmentId+')'
	exec (@sql)


